package com.ehomepay.xyxeample.common.redis.service.impl;

import com.ehomepay.xyxeample.common.redis.property.RedisProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Administrator on 2018/5/8.
 */
public abstract class AbstractRedisClientTemplate {

    protected String cacheSwitch = "1";

    @Autowired
    protected RedisProperties redisProperties;

    protected Boolean cacheOpen = null;

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    protected static final String REDISPREKEY = "ep";

    public boolean isCacheSwitchOpen() {
        if (null != cacheOpen) {
            return cacheOpen;
        }
        if (null == cacheSwitch) {
            cacheOpen = false;
            return cacheOpen;
        }
        int intObj = Integer.parseInt(cacheSwitch);
        if (intObj == 1) {
            cacheOpen = true;
        } else {
            cacheOpen = false;
        }
        return cacheOpen;
    }
}
